// components/video-img/video-img.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    current: 0,
    hasPlay: false
  },

  attached() {
    // this.videoContext = wx.createVideoContext('videos')
  },

  /**
   * 组件的方法列表
   */
  methods: {
    handleChange(event) {
      const videoContext = wx.createVideoContext('videos')
      const current = event.detail.current
      videoContext.pause()
      this.setData({
        hasPlay: false
      })
    },
    handlePlay() {
      const videoContext = wx.createVideoContext('videos')
      console.log(videoContext);
      if (!this.data.hasPlay) {
        videoContext.play()
        this.setData({
          hasPlay: true
        })
      } else {
        videoContext.pause()
        this.setData({
          hasPlay: false
        })
      }
    }
  }
})
